<template>
	<view class="content padding-top-30">
		<view class="" style="padding: 24rpx;background: #FFFFFF;">
			<view class="display-flex align-items">
				<view class="font-size-26" style="width: 200rpx;">
					旧密码
				</view>
				<input type="password" v-model="oldpass" placeholder="请输入旧密码" class="font-size-26" />
			</view>
			<view style="border-top: 1rpx solid #F5F5F5;" class="margin-top-20">

			</view>
			<view class="display-flex align-items margin-top-20">
				<view class="font-size-26" style="width: 200rpx;">
					新密码
				</view>
				<input type="password" v-model="newpass" placeholder="请输入新密码" class="font-size-26" />
			</view>

		</view>
		<view class="display-flex center margin-top-120">
			<view @click="resetpwd()" class=" button text-center color-FFF font-size-26"
				style="padding: 25rpx 266rpx;width: 150rpx;">
				确认修改
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		ref,
		reactive
	} from 'vue';
	import {
		onLoad,
		onShow,
		onReady,
		onReachBottom
	} from '@dcloudio/uni-app';
	import {
		nativeUI,
		navigateTo,
		navigateBack
	} from '@/utils/index.js';
	import * as api from '@/request/app.js'; // 引入api 方法
	import local from '@/utils/localStorage.js'; //引入本地存储方法
	const newpass = ref('')
	const oldpass = ref('')
	onLoad(function(option) {});
	onShow(function() {});
	async function resetpwd() {
		if (!oldpass.value) return nativeUI('请输入旧密码')
		if (!newpass.value) return nativeUI('请输入新密码')
		let object = {
			newpassword: newpass.value,
			oldpassword: oldpass.value
		}
		const {
			code,
			data
		} = await api.resetpwd(object)
		if (code == 1) {
			nativeUI('修改成功！')
			navigateBack()
		}
	}
	onReady(function() {});
	onReachBottom(function() {});
</script>

<style scoped lang="scss"></style>